home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 6: Level 6 / 17 Bit - Level 6 (1998)(Epic Marketing)[!].iso / quartz / q0429.dms / q0429.adf / libray / liblight / light.h < prev    next >
C/C++ Source or Header  |  1991-08-08  |  2KB  |  72 lines

  1. /*
  2.  * light.h
  3.  *
  4.  * Copyright (C) 1989, 1991, Craig E. Kolb
  5.  * All rights reserved.
  6.  *
  7.  * This software may be freely copied, modified, and redistributed
  8.  * provided that this copyright notice is preserved on all copies.
  9.  *
  10.  * You may not distribute this software, in whole or in part, as part of
  11.  * any commercial product without the express consent of the authors.
  12.  *
  13.  * There is no warranty or other guarantee of fitness of this software
  14.  * for any purpose.  It is provided solely "as is".
  15.  *
  16.  * $Id: light.h,v 4.0 91/07/17 14:35:10 kolb Exp Locker: kolb $
  17.  *
  18.  * $Log:    light.h,v $
  19.  * Revision 4.0  91/07/17  14:35:10  kolb
  20.  * Initial version.
  21.  * 
  22.  */
  23. #ifndef LIGHT_H
  24. #define LIGHT_H
  25.  
  26. #include "libobj/geom.h"
  27.  
  28. #define SHADOW_NONE    001
  29. #define SHADOW_TRANSP    002
  30. #define SHADOW_CSG    004
  31. #define SHADOW_CACHE    010
  32. #define SHADOW_BLUR    020
  33.  
  34. #define NOSHADOWS(f)    ((f) & SHADOW_NONE)
  35. #define SHADOWTRANSP(f)    ((f) & SHADOW_TRANSP)
  36. #define SHADOWCSG(f)    ((f) & SHADOW_CSG)
  37. #define SHADOWCACHE(f)    ((f) & SHADOW_CACHE)
  38. #define SHADOWBLUR(f)    ((f) & SHADOW_BLUR)
  39.  
  40. #define SHADOW_EPSILON    (4. * EPSILON)
  41.  
  42. typedef char * LightRef;
  43.  
  44. typedef struct {
  45.     struct Geom *obj;    /* Pointer to cached object */
  46.     RSMatrix trans;    /* World-to-object transformation */
  47.     char dotrans;        /* TRUE if above trans is non-identity */
  48. } ShadowCache;
  49.  
  50. typedef struct {
  51.     int    (*intens)();    /* intensity method */
  52.     void    (*dir)(),    /* direction method */
  53.         (*user)();    /* user-defined method */
  54. } LightMethods;
  55.  
  56. typedef struct Light {
  57.     Color color;        /* Light source color & intensity */
  58.     int shadow;        /* Does light source cast shadows? */
  59.     LightRef light;        /* Pointer to light information */
  60.     LightMethods *methods;    /* Light source methods */
  61.     ShadowCache *cache;    /* Shadow cache, if any */
  62.     struct Light *next;    /* Next light in list */
  63. } Light;
  64.  
  65. extern LightMethods    *LightMethodsCreate();
  66. extern Light    *LightCreate();
  67. extern void    LightAllocateCache(), LightAddToDefined();
  68. extern int    LightIntens(), LightDirection();
  69. extern void    ShadowSetOptions(), ShadowStats();
  70.  
  71. #endif /* LIGHT_H */
  72.